<!-- 题目组件 -->
<template>
  <div class="subject" >
    <span>{{ data.num1 }}</span>
    <span>+</span>
    <span>{{ data.num2 }}</span>
    <span>=</span>
    <input type="number" v-model="sum" />
    <button @click="result" >提交</button>
  </div>
 
</template>

<script>


export default {
data() {
  return {
   sum:''
  };
},
props:['data'],

methods:{
 result(){
  this.$emit('result',this.sum==this.data.num1+this.data.num2?'正确':'错误')
 }
  
},

};
</script>

<style scoped>
.subject {
  margin: 5px;
  padding: 5px;
  font-size: 20px;
}
.subject span {
  display: inline-block;
  text-align: center;
  width: 20px;
}
.subject input {
  width: 50px;
  height: 20px;
}
</style>